$(function () {
    //banner动画
    bannerSwiper = new Swiper('#banner .swiper-container', {
        navigation: {
            nextEl: '#banner .swiper-button-next',
            prevEl: '#banner .swiper-button-prev'
        },
        autoplay: true,
        pagination: {
            el: '#banner .swiper-pagination'
        },
        loop: true
    });
    //环境动画
    schoolSwiper = new Swiper('#school .swiper-container', {
        watchSlidesProgress: true,
        slidesPerView: 'auto',
        centeredSlides: true,
        loop: true,
        loopedSlides: 5,
        autoplay: true,
        navigation: {
            nextEl: '#school .swiper-button-next',
            prevEl: '#school .swiper-button-prev'
        },
        pagination: {
            el: '#school .swiper-pagination'
            //clickable :true,
        },
        on: {
            progress: function (progress) {
                for (i = 0; i < this.slides.length; i++) {
                    var slide = this.slides.eq(i);
                    var slideProgress = this.slides[i].progress;
                    modify = 1;
                    if (Math.abs(slideProgress) > 1) {
                        modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
                    }
                    translate = slideProgress * modify * 260 + 'px';
                    scale = 1 - Math.abs(slideProgress) / 5;
                    zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
                    slide.transform('translateX(' + translate + ') scale(' + scale + ')');
                    slide.css('zIndex', zIndex);
                    slide.css('opacity', 1);
                    if (Math.abs(slideProgress) > 3) {
                        slide.css('opacity', 0);
                    }
                }
            },
            setTransition: function (transition) {
                for (var i = 0; i < this.slides.length; i++) {
                    var slide = this.slides.eq(i);
                    slide.transition(transition);
                }

            }
        }

    });
    //师资力量动画
    teacherSwiper = new Swiper('#teacher .swiper-container', {
        slidesPerView: 5,
        spaceBetween: 15,
        autoplay: true,
        loop: true
    });
    //就业学生动画
    studentSwiper = new Swiper('#student .swiper-container', {
        slidesPerView: 4,
        slidesPerColumn: 2,
        spaceBetween: 10,
        autoplay: true,
        loop: true,
        navigation: {
            nextEl: '#student .swiper-button-next',
            prevEl: '#student .swiper-button-prev'
        },

    });

    //播放器
    var player = new Aliplayer({
        "id": "player-con",
        "source": "upload/video/xuanchuan.mp4",
        "width": "100%",
        "height": "410px",
        "autoplay": false,
        "isLive": false,
        "rePlay": false,
        "playsinline": true,
        "preload": true,
        "controlBarVisibility": "always",
        "useH5Prism": true,
        // "cover": "datas/video-cover.jpg",
        "skinLayout": [
            {
                "name": "bigPlayButton",
                "align": "blabs",
                "x": 30,
                "y": 80
            },
            {
                "name": "thumbnail"
            },
            {
                "name": "controlBar",
                "align": "blabs",
                "x": 0,
                "y": 0,
                "children": [
                    {
                        "name": "progress",
                        "align": "blabs",
                        "x": 0,
                        "y": 44
                    },
                    {
                        "name": "playButton",
                        "align": "tl",
                        "x": 15,
                        "y": 12
                    },
                    {
                        "name": "timeDisplay",
                        "align": "tl",
                        "x": 10,
                        "y": 7
                    }
                ]
            }
        ]
    });
})
